package com.lmu.travel.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liuxuhuang
 * @className: EPConfig
 * @description: mybatis-plus配置
 * @email liuxuhuang3970@qq.com
 * @date 2021/6/28 19:16
 * @version：1.0
 */
@Configuration
@ConditionalOnClass(value = {PaginationInnerInterceptor.class})
public class EPConfig {
    /**
     * mybatis-plus自带的分页插件
     *
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
    
}
